package com.zjh.shop.controller;

import com.zjh.shop.client.UserFeignClient;
import com.zjh.shop.dto.DemoInputDTO;
import com.zjh.common.util.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/shop")
public class ShopController {
    @Autowired
    private UserFeignClient userFeignClient;

    @Value("${mydefine.pay_status}")
    private String payStatus;

    @GetMapping("show")
    public String show(@RequestBody DemoInputDTO demoInputDTO){
       /* DemoInputDTO demoInputDTO = new DemoInputDTO();
        demoInputDTO.setMsg("nihao");
        demoInputDTO.setStatus(1);*/
        return userFeignClient.hello(demoInputDTO);
    }

    @GetMapping("call-user-show")
    public String callUserShow(@RequestHeader(value = "X-Request-red", required = false) String color){
        System.out.println("打印支付状态" + payStatus);

        System.out.println("header-color:"+color);
        //获取用户id
        System.out.println("用户id:"+ UserContext.getUser());
        return userFeignClient.show();
    }

}
